package cms.web.localflush;

import cms.web.action.topic.TopicManage;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/local/flush")
public class FlushCacheController {
    @Resource
    private TopicManage topicManage;

    @Value("${bbs-local.pwd}")
    private String pwd;

    @GetMapping("/topic-flush")
    public Object topicFlush(Long topicId, String pwd) {
        if(!this.pwd.equals(pwd)) {
            return false;
        }
        this.topicManage.deleteTopicCache(topicId);
        topicManage.delete_cache_analysisHiddenTag(topicId);//删除解析隐藏标签缓存
        topicManage.delete_cache_analysisFullFileName(topicId);//删除 解析上传的文件完整路径名称缓存
        topicManage.delete_cache_markUpdateTopicStatus(topicId);//删除 标记修改话题状态
        return true;
    }

}
